1. Field of the Invention
The present invention relates to a calibration program for calibrating the output of a magnetic sensor, which detects terrestrial magnetism. In addition, the invention further relates to an electronic compass that is provided with such a calibration program.
2. Description of the Related Art
An electronic compass is a device that calculates a directional angle with respect to a reference direction with the use of the output of a magnetic sensor. Since an electronic compass is mounted on a handheld terminal device such as a mobile phone or the like, it might not be possible, in some cases, to calculate a compass bearing accurately due to the adverse effects of magnetized peripheral parts that are mounted in the handheld terminal device. That is, although an electronic compass is capable of calculating a compass direction accurately when the output of its magnetic sensor contains components corresponding to earth magnetism only, it is not possible to obtain an accurate output corresponding to the amount of terrestrial magnetism due to an offset added to the output of the magnetic sensor if the peripheral parts of the magnetic sensor are magnetized.
As a method for correcting the offset of a magnetic-sensor output, there is an offset correction method according to which a device on which an electronic compass is mounted is turned in each of the X-axis direction, the Y-axis direction, and the Z-axis direction; and then, an average of the maximum output values and the minimum output values is calculated so as to perform offset correction (Patent Document 1).
Patent Document 1: Japanese Unexamined Patent Application Publication No. 2005-265414 (Prior Art).